package com.ym.medical.enums;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.StdConverter;
import com.ym.common.annotations.EnumDescription;
import com.ym.common.constant.DictEnum;

/**
 * @author dai
 * @create 2019-05-05 9:45
 * 价格区间
 **/
@EnumDescription("价格区间")
public enum PriceIntervalEnum implements DictEnum {
    /*0-10*/
    FIRSTPRICE("01","0-10"),
    /*11-30*/
    SECONDPRICE("02","11-30"),
    /*31-50*/
    THRIDPRICE("03","31-50"),
    /*51-以上*/
    FOURTHPRICE("04","51-以上"),
    ;
    private String key;

    private String value;

    PriceIntervalEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    /**
     * 序列化使用
     */
    public static class Covert extends StdConverter<String, JSONObject> {
        @Override
        public JSONObject convert(String value) {
            return DictEnum.valueOfJson(PriceIntervalEnum.class, value);
        }
    }
}
